package rs.dalao.syc.user.all.dao.persist.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import rs.dalao.syc.user.all.dao.persist.mapper.IUserMapper;
import rs.dalao.syc.user.all.dao.persist.repository.IUserRepository;
import rs.dalao.syc.user.all.pojo.entity.User;
import rs.dalao.syc.user.all.pojo.param.UserUpdateParam;
import rs.dalao.syc.user.all.pojo.vo.UserInfoUpdateVO;

@Repository
public class UserRepositoryImpl implements IUserRepository {
    @Autowired
    private IUserMapper userMapper;
    @Override
    public String getAvatar(Long id) {
        return userMapper.getAvatar(id);
    }

    //更新用户的头像，昵称信息
    @Override
    public int update(UserUpdateParam userUpdateParam,Long id) {
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id", id);
        User user = new User();
        BeanUtils.copyProperties(userUpdateParam,user);
        return userMapper.update(user,queryWrapper);
    }
}
